package org.mixed.core.resource.info;

import com.fasterxml.jackson.core.type.TypeReference;
import lombok.Getter;
import lombok.Setter;
import org.mixed.core.domain.api.Parameter;
import org.mixed.core.resource.Info;
import org.mixed.core.utils.JsonUtils;

import java.util.Collections;
import java.util.List;
import java.util.Objects;

@Getter
@Setter
public class FunctionInfo extends Info {
	private String description;
	private String returnType;
	private String mappingPath;
	private String path;

	private List<Parameter> parameters = Collections.emptyList();

	public void setParameter(String parameter) {
		this.parameters = JsonUtils.readValue(Objects.toString(parameter, "[]"), new TypeReference<List<Parameter>>() {
		});
	}
}
